import request from '@/utils/request'

const api = {
  page: '/declarationSystem/page',
  declarationSystem: '/declarationSystem',
  releaseSystem: '/declarationSystem/release',
  getOrganizationTypes: '/declarationSystem/getOrganizationTypes',
  getDeclarationLevels: '/declarationSystem/getDeclarationLevels',
  declarationInfo: '/declarationInfo',
  getPage: '/declarationInfo/getPage',
  getDeclarationInfoDetail: '/declarationInfo/getDeclarationInfoDetail',
  getQuatoPage: '/targetDeclarationRecord/page',
  getQuatoDetail: '/targetDeclarationRecord',
  getIsHave: '/targetDeclarationRecord/isHave',
  getReplyListByRecord: '/targetDeclarationRecordReply/listByRecordId',
  addReply: '/targetDeclarationRecordReply/add',
  scoreRecord: '/targetDeclarationRecord/score',
  getScore: '/targetDeclarationRecord/getScore',
  pleaseModifyRecord: '/message/pleaseModifyRecord',
  isUserCheck: '/targetDeclarationRecord/isUserCheck',
  isAllScore: '/targetDeclarationRecord/isAllScore',
  auditRecord: '/targetDeclarationRecord/audit',
  getAllFile: '/declarationInfo/getAllFile',
  checkUpdateStatus: '/targetDeclarationRecord/checkUpdateStatus',
  next: '/targetDeclarationRecord/next',
  SupplementFile: '/declarationInfoSupplementFile/upload',
  getFileList: '/declarationInfoSupplementFile/getByDeclarationInfoId',
  batchSaveDataFile: '/declarationInfoSupplementFile/batchSaveData'
}
// 体系列表
export function getSystem (parameter) {
  return request({
    url: api.page,
    method: 'get',
    params: parameter
  })
}
// 体系详情
export function getSystemDetail (parameter) {
  return request({
    url: api.declarationSystem + `/${parameter.id}`,
    method: 'get'
  })
}
// 新增编辑体系
export function saveSystem (parameter) {
  return request({
    url: api.declarationSystem,
    method: parameter.id === 0 ? 'post' : 'put',
    data: parameter
  })
}
// 删除体系
export function deleteSystem (parameter) {
  return request({
    url: api.declarationSystem + `/${parameter.id}`,
    method: 'delete'
  })
}
// 发布
export function releaseSystem (parameter) {
  return request({
    url: api.releaseSystem + `/${parameter.id}`,
    method: 'put'
  })
}
// 根据申报体系id 查询社会组织类型
export function getOrganizationTypes (parameter) {
  return request({
    url: api.getOrganizationTypes,
    method: 'get',
    params: parameter
  })
}
// 根据申报体系id 查询申报级别
export function getDeclarationLevels (parameter) {
  return request({
    url: api.getDeclarationLevels,
    method: 'get',
    params: parameter
  })
}
// 申报列表
export function getOrgList (parameter) {
  return request({
    url: api.getPage,
    method: 'get',
    params: parameter
  })
}
// 申报列表
export function putOrg (parameter) {
  return request({
    url: api.declarationInfo,
    method: 'put',
    data: parameter
  })
}
// 申报详情
export function getDeclarationInfo (parameter) {
  return request({
    url: api.declarationInfo + `/${parameter.id}`,
    method: 'get'
  })
}
// 申报组织详情概况
export function getDeclarationInfoDetail (parameter) {
  return request({
    url: api.getDeclarationInfoDetail + `/${parameter.id}`,
    method: 'get'
  })
}
// 根据申报体系查询社会组织指标填报列表
export function getRecordQuatoPage (parameter) {
  return request({
    url: api.getQuatoPage,
    method: 'get',
    params: parameter
  })
}
// 根据指标填报记录id查询指标填报详情
export function getQuatoDetail (parameter) {
  return request({
    url: api.getQuatoDetail + `/${parameter.id}`,
    method: 'get'
  })
}
// 判断某个指标是否填报(获取已填报指标详情)
export function getIsHave (parameter) {
  return request({
    url: api.getIsHave,
    method: 'get',
    params: parameter
  })
}
// 回复列表
export function getReplyListByRecord (parameter) {
  return request({
    url: api.getReplyListByRecord,
    method: 'get',
    params: parameter
  })
}
// 回复
export function addReply (parameter) {
  return request({
    url: api.addReply,
    method: 'post',
    data: parameter
  })
}
// 指导老师和评审专家打分
export function scoreRecord (parameter) {
  return request({
    url: api.scoreRecord,
    method: 'get',
    params: parameter
  })
}
// 专家打分批注记录（扣分原因）
export function getScoreReason (parameter) {
  return request({
    url: api.getScore,
    method: 'get',
    params: parameter
  })
}
// 驳回填报，提交修改
export function pleaseModifyRecord (parameter) {
  return request({
    url: api.pleaseModifyRecord,
    method: 'post',
    data: parameter
  })
}
// 某填报是否轮到审核
export function isUserCheck (parameter) {
  return request({
    url: api.isUserCheck,
    method: 'get',
    params: parameter
  })
}
// 判断某个申报是否都打分完
export function isAllScore (parameter) {
  return request({
    url: api.isAllScore,
    method: 'get',
    params: parameter
  })
}
// 审核专家提交下一级
export function auditRecord (parameter) {
  return request({
    url: api.auditRecord,
    method: 'get',
    params: parameter
  })
}
// 下载合并文件
export function getAllFile (parameter) {
  return request({
    url: api.getAllFile,
    method: 'get',
    params: parameter
  })
}
// 修改 是否修改的状态
export function checkUpdateStatus (parameter) {
  return request({
    url: api.checkUpdateStatus,
    method: 'get',
    params: parameter
  })
}
// 上一条，下一条指标记录
export function nextRecord (parameter) {
  return request({
    url: api.next,
    method: 'get',
    params: parameter
  })
}

// 上传补充材料
export function uploadSupplement (data) {
  return request({
    url: api.SupplementFile,
    method: 'post',
    data
  })
}

// 查看文件列表
export function getFileList (id) {
  return request({
    url: api.getFileList + '/' + id,
    method: 'get'
  })
}

// 保存文件
export function batchSaveDataFile (data) {
  return request({
    url: api.batchSaveDataFile,
    method: 'post',
    data
  })
}

// 获取异步文件状态
export function getTaskFileStatus (taskId) {
  return request({
    url: `/declarationInfo/checkHeartbeat/${taskId}`,
    method: 'get'
  })
}

//  获取申报类别
export function indexCategoryList () {
  return request({
    url: '/socialOrganizationType/currentList',
    method: 'get'
  })
}


//  申报类别获取指标列表
export function indexListByCate (params) {
  return request({
    url: '/targetManagement/list',
    method: 'get',
    params
  })
}